﻿<%@ Register TagPrefix="ucCommon" TagName="Common" Src="../Common/Inc/Common.ascx" %>
<%@ Register TagPrefix="ucComment" TagName="Comment" Src="../Common/Inc/Comment.ascx" %>
<%@ Register TagPrefix="ucTop" TagName="Top" Src="../Common/Inc/Top.ascx" %>
<%@ Register TagPrefix="ucMenu" TagName="Menu" Src="../Common/Inc/Menu.ascx" %>
<%@ Register TagPrefix="ucTabTitle" TagName="TabTitle" Src="../Common/Inc/TabTitle.ascx" %>
<%@ Register TagPrefix="ucCopyright" TagName="Copyright" Src="../Common/Inc/Copyright.ascx" %>
<%@ Register Assembly="ChartFX.WebForms" Namespace="ChartFX.WebForms" TagPrefix="chartfx7" %>
<%@ Register Assembly="ChartFX.WebForms.Adornments" Namespace="ChartFX.WebForms.Adornments" TagPrefix="chartfxadornments" %>
<%@ Register Assembly="ChartFX.WebForms" Namespace="ChartFX.WebForms.Galleries" TagPrefix="chartfx7galleries" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Crd2019r.aspx.cs" Inherits="Updms.Crd.Crd2019r" validateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>▒ UPDMS [Crd2019r] ▒▒▒▒▒▒▒▒▒▒</title>
<ucCommon:Common id="Common" runat="server"></ucCommon:Common>
</head>
<body onload="setResize();initMenu();">
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager1" EnableScriptGlobalization="true"></asp:ScriptManager>

<table id="table_frame">
	<tr>
		<td id="top_area" colspan="2">
			<!-- Top 시작 -->
			<ucTop:Top id="Top" runat="server"></ucTop:Top>
			<!-- Top 끝 -->
		</td>
	</tr>
	<tr>
		<td id="menu_area">
			<!-- 메뉴 시작 -->
			<ucMenu:Menu id="Menu" runat="server"></ucMenu:Menu>
			<!-- 메뉴 끝 -->
		</td>
		<td id="contents_area">
			<!-- 제목 시작 -->
			<ucTabTitle:TabTitle id="TabTitle" TagPrefixs="Crd2019r" runat="server"></ucTabTitle:TabTitle>
			<!-- 제목 끝 -->
			<!-- AJAX 시작 -->
			<asp:UpdatePanel ID="UpdatePanel1" runat="server">
			<Triggers>
				<asp:PostBackTrigger ControlID="ibtn_excel"/>
			</Triggers>
			<ContentTemplate>
			<!-- 버튼 시작 -->
			<div class="button_area">
				<asp:linkbutton id="ibtn_excel" Text="엑셀" runat="server" CssClass="ibtn ibtn_excel" OnClick="ibtn_excel_Click"></asp:linkbutton>
				<asp:linkbutton id="ibtn_map" Text="지도" runat="server" CssClass="ibtn ibtn_map" OnClientClick="showNaverMapMultiMarker();return false;"></asp:linkbutton>
				<asp:linkbutton id="ibtn_search" Text="검색" runat="server" CssClass="ibtn ibtn_search" OnClientClick="return chkSearch()" OnClick="ibtn_search_Click"></asp:linkbutton>
			</div>
			<!-- 버튼 끝 -->			
			<!-- 검색 시작 -->
			<table class="table_search">
				<tr>
					<td class="lbl" width="11%"><asp:Literal id="ltr_search_region" Text="검색기간" runat="server" /></td>
					<td class="ctl" width="66%">
						<asp:dropdownlist id="ddl_search_from_year" runat="server"></asp:dropdownlist><asp:dropdownlist id="ddl_search_from_month" runat="server">
										<asp:ListItem Value="01">01</asp:ListItem>
										<asp:ListItem Value="02">02</asp:ListItem>
										<asp:ListItem Value="03">03</asp:ListItem>
										<asp:ListItem Value="04">04</asp:ListItem>
										<asp:ListItem Value="05">05</asp:ListItem>
										<asp:ListItem Value="06">06</asp:ListItem>
										<asp:ListItem Value="07">07</asp:ListItem>
										<asp:ListItem Value="08">08</asp:ListItem>
										<asp:ListItem Value="09">09</asp:ListItem>
										<asp:ListItem Value="10">10</asp:ListItem>
										<asp:ListItem Value="11">11</asp:ListItem>
										<asp:ListItem Value="12">12</asp:ListItem>
									</asp:dropdownlist>&nbsp;~&nbsp;<asp:dropdownlist id="ddl_search_to_year" runat="server"></asp:dropdownlist><asp:dropdownlist id="ddl_search_to_month" runat="server">
										<asp:ListItem Value="01">01</asp:ListItem>
										<asp:ListItem Value="02">02</asp:ListItem>
										<asp:ListItem Value="03">03</asp:ListItem>
										<asp:ListItem Value="04">04</asp:ListItem>
										<asp:ListItem Value="05">05</asp:ListItem>
										<asp:ListItem Value="06">06</asp:ListItem>
										<asp:ListItem Value="07">07</asp:ListItem>
										<asp:ListItem Value="08">08</asp:ListItem>
										<asp:ListItem Value="09">09</asp:ListItem>
										<asp:ListItem Value="10">10</asp:ListItem>
										<asp:ListItem Value="11">11</asp:ListItem>
										<asp:ListItem Value="12">12</asp:ListItem>
									</asp:dropdownlist>&nbsp;<asp:linkbutton id="sbtn_6_m" runat="server" ToolTip="6개월" OnClick="sbtn_6_m_Click"><img src="../Common/Images/calendar_6m.gif" align="top"></asp:linkbutton><asp:linkbutton id="sbtn_12_m" runat="server" ToolTip="12개월" OnClick="sbtn_12_m_Click"><img src="../Common/Images/calendar_12m.gif" align="top"></asp:linkbutton><asp:linkbutton id="sbtn_all_m" runat="server" ToolTip="전체" OnClick="sbtn_all_m_Click"><img src="../Common/Images/calendar_all.gif" align="top"></asp:linkbutton>
					</td>
				</tr>
				<tr>
					<td class="lbl"><a href="javascript:void(0);" title="전체선택/해제" onclick="checkBoxCheckTable('cbl_search_card_cd');"><u><asp:Literal id="ltr_search_card_cd" Text="카드" runat="server" /></u></a></td>
					<td class="ctl"><asp:CheckBoxList id="cbl_search_card_cd" runat="server" RepeatDirection="Horizontal" CssClass="cbl_flow"></asp:CheckBoxList></td>
				</tr>				
			</table>
			<!-- 검색 끝 -->
			<!-- 디테일1 시작 -->
			<!-- 디테일1 끝 -->
			<!-- 리스트셋 시작 -->			
			<table id="table_list_set" cellspacing="0" cellpadding="0" width="100%" border="0" runat="server">
				<tr>
					<td valign="top">
						<div class="div_scroll_x" style="width:195px">
						<asp:GridView ID="gv_account" CssClass="table_gridview" GridLines="None" runat="server" AutoGenerateColumns="False" OnRowDataBound="gv_account_RowDataBound" DataKeyNames="View_Order">
							<Columns>
								<asp:BoundField HeaderText="계정" DataField="Account_Nm" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Left" Width="100%" />
									<HeaderStyle HorizontalAlign="Center" />
								</asp:BoundField>
							</Columns>
						</asp:GridView>
						</div>
					</td>
					<td valign="top">
						<div id="div_box" class="div_scroll_x">
						<asp:GridView ID="gv_data" CssClass="table_gridview" GridLines="None" runat="server" AutoGenerateColumns="True" OnRowDataBound="gv_data_RowDataBound" DataKeyNames="View_Order">
							<Columns>
							</Columns>
						</asp:GridView>
						</div>
					</td>
					<td valign="top">
						<div class="div_scroll_x" style="width:90px">
						<asp:GridView ID="gv_total" CssClass="table_gridview" GridLines="None" runat="server" AutoGenerateColumns="False" OnRowDataBound="gv_total_RowDataBound" DataKeyNames="View_Order">
							<Columns>
								<asp:BoundField HeaderText="총액" DataField="Total" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Right" Width="100%" />
									<HeaderStyle HorizontalAlign="Center" />
								</asp:BoundField>
							</Columns>
						</asp:GridView>
						</div>
					</td>
				</tr>
			</table>
			<table class="table_gridview" cellspacing="0" border="0" id="gv_data_nodata" style="border-collapse:collapse;" runat="server">
				<tr>
					<td><div id="no_data"></div></td>
				</tr>
			</table>
			
			<!-- 리스트셋 끝 -->
			<!-- 모달영역(라인챠트) 시작 -->
			<asp:Panel ID="Panel1" style="display:none;" runat="server">
				<div class="div_box">
				<img id="img_close" src="../Common/Images/close.gif" class="hand" style="float:right;" onclick="hideChartByAccount();" alt="닫기" /><br />
				<chartfx7:chart id="chart_line" runat="server" height="200px" width="1000px" Palette="ChartFX6.ChartFX6" ImageSettings-Interactive="False">
					<AxisY Title-Text="금액 (원)">
					<Grids Major-Style="Dash" Interlaced="True"></Grids>
						<LabelsFormat CustomFormat="###,###,##0" />
					</AxisY>

					<AxisX Title-Text="">
					<Grids Major-Visible="False"></Grids>
					</AxisX>

					<AllSeries PointLabels-Visible="True"></AllSeries>

					<LegendBox ContentLayout="Near" Dock="Bottom"></LegendBox>

					<MainPane AxisY-Title-Text="금액 (원)"></MainPane>
					<SpecialObjects>
						<chartfxadornments:SimpleBorder AssemblyName="ChartFX.WebForms.Adornments" Color="Transparent"
							Type="None">
						</chartfxadornments:SimpleBorder>
						<chartfxadornments:GradientBackground AssemblyName="ChartFX.WebForms.Adornments"
							ColorFrom="Transparent" EffectArea="0">
						</chartfxadornments:GradientBackground>
					</SpecialObjects>
				<Series>
					<chartfx7:SeriesAttributes />
				</Series>
				</chartfx7:chart>
				</div>
			</asp:Panel>
			<!-- 모달영역(라인챠트) 끝 -->
			<!-- 설명 시작 -->
				<ucComment:Comment id="Comment" TagPrefixs="Crd2019r" runat="server"></ucComment:Comment>
			<!-- 설명 끝 -->
			<!-- 카피라이트 시작 -->
			<ucCopyright:Copyright id="Copyright" runat="server"></ucCopyright:Copyright>
			<!-- 카피라이트 끝 -->
			<!-- 히든값 시작 -->
			<div id="hdn_data">
				<asp:label id="lbl_pk" runat="server"></asp:label>
				<input type="hidden" id="h_row_idx" name="h_row_idx" value="" runat="server" />
				<input type="hidden" id="h_card_cd" name="h_card_cd" value="" runat="server" />
				<input type="hidden" id="h_card_nm" name="h_card_nm" value="" runat="server" />
				<asp:LinkButton ID="lbtn_set_chart" OnClick="lbtn_set_chart_Click" runat="server" />
			</div>
			<!-- 히든값 끝 -->
			<act:ModalPopupExtender ID="mpe_chart_line" runat="server"
				BehaviorID="mpe_chart_line_b"
				TargetControlID="lbtn_set_chart"
				PopupControlID="Panel1"
				CancelControlID="img_close"
				BackgroundCssClass="modalBackground" />
			</ContentTemplate>
			</asp:UpdatePanel>
			<!-- AJAX 끝 -->
		</td>
	</tr>
</table>

<asp:updateprogress AssociatedUpdatePanelID="UpdatePanel1" ID="updateProgress" runat="server">
	<progresstemplate>
		<div id="progressBackgroundFilter"></div>
		<div id="processMessage">
			<div id="processing"></div>
			<img src="../Common/Images/processing_img.gif" />
		</div>
	</progresstemplate>
</asp:updateprogress>

</form>

<script type="text/javascript" language="javascript" defer="defer">
	setTimeout("window.onresize=setResize", 0);
	
	//해상도에 맞게 넓이 재지정
	function setResize() {
		var div_box = $("div_box");
		var gridview = $("gv_data");
		var menuHide = $("menuHide");	//메뉴가 숨겨져 있는지 여부
		var menu_width = 470;			//메뉴가 보여지면 메뉴만큼 뺀다.	185(메뉴-펼쳐진) + 195(계정) + 90(총액)
		var gridview_width = "100%";	//그리드뷰 기본 넓이

		//메뉴가 숨겨지면
		if (menuHide != "undefined" && menuHide.style.display == "none") {
			menu_width = 318;	//33(메뉴-접힌) + 195(계정) + 90(총액)
		}

		var windowWidth = document.documentElement.clientWidth - menu_width;

		div_box.style.width = windowWidth + "px"; //div_box

		//검색기간 차이개월수를 구해서 gridview1의 넓이를 지정 (14개월보다 작으면 100%, 크면 개월수 * 90px)
		var from_dt = $F("ddl_search_from_year") + $F("ddl_search_from_month");
		var to_dt = $F("ddl_search_to_year") + $F("ddl_search_to_month");

		var diff = getDiffMonth(from_dt, to_dt);

		if (diff > 14) {
			gridview_width = (diff * 90) + "px";
		}

		gridview.style.width = gridview_width;
	}
	
	//검색
	function chkSearch() {
		var lb_checked_card = false;
		var lb_checked_account = false;

		//체크박스 갯수
		var cb_cnt_card = getCheckBoxCntOnTable("cbl_search_card_cd");

		//카드체크여부
		for (var i = 0; i < cb_cnt_card; i++) {
			var cb = $("cbl_search_card_cd_" + i);
			if (cb.checked) {
				lb_checked_card = true;
			}
		}

		if (!lb_checked_card) {
			msgBox.alert(getMsg(MSG_ERR_023)); //하나이상의 카드를 선택하세요
			return false;
		}

		//검색기간
		var from_dt = $F("ddl_search_from_year") + $F("ddl_search_from_month");
		var to_dt = $F("ddl_search_to_year") + $F("ddl_search_to_month");

		// 검색기간
		if (!isDateSeq(from_dt, to_dt)) {
			msgBox.alert(getMsg(MSG_ERR_022)); //시작일자가 종료일자보다 늦을수 없습니다
			return false;
		}

		return true;
	}
	
	//상세조회 팝업
	function viewDetailList(card_cd, account, ym) {
		var url = "../Crd/Crd3011p.aspx?page_mode=P&kw1=" + card_cd + "&kw2=" + ym + "&kw3=" + account;
		popupPage(url, 800, 600, 'yes','no','yes');
	}

	//계정별 챠트
	function viewChartByAccount(idx) {
		$("h_row_idx").value = idx;
		__doPostBack('lbtn_set_chart', '');
	}

	//챠트 숨기기
	function hideChartByAccount() {
		var mpeBehavior = $find('mpe_chart_line_b');
		mpeBehavior.hide();
	}

	//월간사용분석표
	function viewMonthlyAmountByCardNAccount(ym) {
		if ($("cbl_search_card_cd") != null) {
			var lb_checked_item = false;
			//체크박스 갯수
			var cb_cnt_item = getCheckBoxCntOnTable("cbl_search_card_cd");

			for (var i = 0; i < cb_cnt_item; i++) {
				var cb = $("cbl_search_card_cd_" + i);
				if (cb.checked) {
					lb_checked_item = true;
				}
			}

			if (!lb_checked_item) {
				msgBox.alert(getMsg(MSG_ERR_023)); //하나이상의 카드를 선택하세요
				return false;
			}
		}

		var url = "../Crd/Crd3013p.aspx?page_mode=P&kw1=" + $F("h_card_cd") + "&kw2=" + ym + "&gs_card_nm=" + encodeURIComponent($F("h_card_nm"));

		popupPage(url, 960, 760, 'yes', 'yes', 'yes');
	}

	//지도팝업 - 멀티마커
	function showNaverMapMultiMarker() {
		var url = "../Common/Inc/NaverMapMultiMarker.aspx?mode=CRD&param=" + $F("h_card_cd") + "";
		popupPage(url, 600, 600, 'yes', 'yes', 'yes');
	}

</script>

</body>
</html>